<?php

    defined('BASEPATH') OR exit('No direct script access allowed');

    Class Template {

        var $template_data = array();
        var $template_view = "layout";

        function set($name, $value) {
            $this->template_data[$name] = $value;
        }

        function set_view($name) {
            $this->template_view = $name;
        }

        function load($view = '', $view_data = array(), $return = FALSE) {
            $this->CI = & get_instance();

            // set session data for view
//            $view_data['session'] = $this->CI->session->userdata('my_data');
            //$this->CI->firephp->log($view_data['session']);
            
            $view_data['host_url'] = HOST_URL;
            $this->set('contents', $this->CI->load->view($view, $view_data, TRUE));
            
            return $this->CI->load->view('layouts/' . $this->template_view, $this->template_data, $return);
        }

    }

?>
